# class Earth:
#     pass
#
#
# a = Earth()
# print(id(a))  # 1870552644528
# b = Earth()
# print(id(b))  # 1870552644864
# # 创建的是不同对象

class Earth:
    __instance = None

    def __new__(cls):
        if cls.__instance is None:
            cls.__instance = object.__new__(cls)
            return cls.__instance
        else:
            return cls.__instance

a = Earth()
print(id(a))  # 2663809563904
b = Earth()
print(id(b))  # 2663809563904
# # 创建的是相同对象